<?php

use App\Models\Instructors;
use App\Models\Members;
use App\Models\User;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('reports', function (Blueprint $table) {
            $table->id();
//            $table->foreignIdFor(Instructors::class,'instructors_id');
//            $table->foreignIdFor(Members::class,'members_id');
//            $table->foreignIdFor(User::class,'user_id');
            $table->unsignedBigInteger('instructors_id');
            $table->foreign('instructors_id', 'reports_instructors_fk')
                ->on('instructors')->references('id');

            $table->unsignedBigInteger('members_id');
            $table->foreign('members_id', 'reports_members_fk')
                ->on('members')->references('id');


            $table->unsignedBigInteger('user_id');
            $table->foreign('user_id', 'reports_user_fk')
                ->on('users')->references('id');

            $table->string('months');
            $table->string('lessons');
            $table->string('equipment');
            $table->string('free_lessons');
            $table->string('grants');
            $table->string('pay_lessons');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('reports');
    }
};
